import java.util.*;

public class Main21 {
    private static int n;
    private static int m;
    private static int[] hash;
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        n = in.nextInt();
        m = in.nextInt();
        hash = new int[n+1];
        int hashMax = 0;
        int[] a = new int[n];
        for(int i = 0; i < n; i++) {
            a[i] = in.nextInt();
            hash[a[i]]++;
            hashMax = Math.max(hashMax, hash[a[i]]);
        }
        
//         for(int ret = 1; ret <= hashMax; ret++) {
//             if(check(ret)){
//                 System.out.println(ret);
//                 return;
//             }
//         }
        int l = 1;
        int r = hashMax;
        while(l < r) {
            int mid = (l + r) / 2;
            if(check(mid)) {
                r = mid;
            }else {
                l = mid + 1;
            }
        }
        if(l == hashMax) {
            System.out.println(-1);
        }else {
            System.out.println(r);
        }
    }
    
    private static boolean check(int x) {
        int sum = 0;
        for(int i = 1; i <= n; i++) {
            sum += hash[i] / x + (hash[i] % x == 0 ? 0 : 1);
        }
        if(sum <= m) {
            return true;
        }else {
            return false;
        }
    }
}